#include <stdio.h>

int gcd(int a, int b) 
{
    if (b == 0) 
        return a;
    else 
        return gcd(b, a % b);
}

int main() 
{
    int N;
    scanf("%d", &N);
    int max_lcm = 0;
	int i,j,k,lcm;
    for (i = N; i >= N - 2 && i > 0; i--) 
	{
        for (j = i; j >= N - 2 && j > 0; j--) 
		{
            for (k = j; k >= N - 2 && k > 0; k--) 
			{
                lcm = (i * j) / gcd(i, j);
                lcm = (lcm * k) / gcd(lcm, k);
                if (lcm > max_lcm) 
                    max_lcm = lcm;
            }
        }
    }
    
    printf("%d\n", max_lcm);

    return 0;
}
